package com.medical.app.controller;

import com.medical.app.common.dto.BeHospitalizedDto;
import com.medical.app.common.dto.HospitalizedRechargeDto;
import com.medical.app.common.dto.MedicalRecordDto;
import com.medical.app.service.HospitalizedService;
import com.qf.medical.response.ResponseEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 1.根据患者查询住院记录
 * 2.住院充值
 * 3.住院充值记录
 * 4.查询指定时间段的所有病历信息
 * 5.查询病历详情
 */
@Api(tags = "客户端住院服务api在线文档")
@RestController
@RequestMapping("/hospitalized")
public class HospitalizedController {
    @Resource
    private HospitalizedService hospitalizedService;

    @ApiOperation("查询住院记录")
    @GetMapping("/searchHospitalized")
    @ApiImplicitParam(name = "patientId",value = "患者id")
    public ResponseEntity<List<BeHospitalizedDto>> searchHospitalized(@NotNull Long patientId) {
        return ResponseEntity.success(hospitalizedService.searchHospitalized(patientId));
    }

    @ApiOperation("住院充值信息回显")
    @GetMapping("/hospitalizedRecharge")
    @ApiImplicitParam(name = "patientId",value = "患者id")
    public ResponseEntity<HospitalizedRechargeDto> hospitalizedRecharge(@NotNull Long patientId) {
        return ResponseEntity.success(hospitalizedService.hospitalizedRecharge(patientId));
    }

    @ApiOperation("查询住院充值记录")
    @PostMapping("/getHospitalList")
    @ApiImplicitParam(name = "patientId",value = "患者id")
    public ResponseEntity<List<HospitalizedRechargeDto>> getHospitalList(@NotNull @RequestBody HospitalizedRechargeDto hospitalizedRechargeDto) {
        return ResponseEntity.success(hospitalizedService.getHospitalList(hospitalizedRechargeDto));
    }

    @ApiOperation("查询病历信息")
    @GetMapping("/getMedicalRecord")
    @ApiImplicitParam(name = "patientId",value = "患者id")
    public ResponseEntity<List<MedicalRecordDto>> getMedicalRecord(@NotNull Long patientId) {
        return ResponseEntity.success(hospitalizedService.getMedicalRecord(patientId));
    }

    @ApiOperation("查询病历详情")
    @GetMapping("/detailMedicalRecord")
    @ApiImplicitParam(name = "patientId",value = "患者id")
    public ResponseEntity<MedicalRecordDto> detailMedicalRecord(@NotNull Integer recordId) {
        return ResponseEntity.success(hospitalizedService.detailMedicalRecord(recordId));
    }

}
